using System;
using Sinacor.Infra.Common;
using System.Collections.Generic;
using Sinacor.Service.Infra.AuthorizationService.Service.DataContract.Request;
using Sinacor.Service.Infra.AuthorizationService.BusinessEntity;

namespace Sinacor.Service.Infra.AuthorizationService.Service.ServiceImplementation.Translator
{
    /// <summary>
    /// Classe tradutora entre objetos Policy e PolicyResponse
    /// </summary>
    public class PolicyToPolicyResponse :  
        BaseTranslator<DataContract.Response.PolicyResponse, BusinessEntity.Policy,
                        List<DataContract.Response.PolicyResponse>,List<BusinessEntity.Policy>>
    {
        public override DataContract.Response.PolicyResponse Translate(BusinessEntity.Policy from)
        {
            if (from == null)
                return null;

            DataContract.Response.PolicyResponse to = new DataContract.Response.PolicyResponse();
            to.PolicyId = from.PolicyId;
            to.PolicyName = from.PolicyName;

            DataContract.Enum.PolicyStatus? status;
            PolicyStatusTranslator statusTranslator = new PolicyStatusTranslator();
            statusTranslator.Translate(from.PolicyStatus, out status);
            to.PolicyStatus = status;

            DataContract.Enum.PolicyType? policyType;
            PolicyTypeTranslator policyTypeTranslator = new PolicyTypeTranslator();
            policyTypeTranslator.Translate(from.PolicyType, out policyType);
            to.PolicyType = policyType;

            return to;
        }



    }
}

